/*
 * EventFrame.java
 * Team qq 2011
 */
package com.google.code.timetrail.gui;

import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JButton;

import com.google.code.timetrail.backend.Control;
import com.google.code.timetrail.backend.Event;

import java.awt.CardLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class EventFrame extends JPanel{
	private JPanel myCD;
	Control myControl;
	public EventFrame(Control gameControl, EventFrameBackend eventFrameBackend, JPanel cd) {
		this.myControl = gameControl;
		this.myCD = cd;
		

		
		JLabel eventPicture = new JLabel("PICTURE REFLECTING EVENT GOES HERE");
		
		JLabel lblBigJlabelDescribing = new JLabel(eventFrameBackend.getMessage());
		
		JButton btnNewButton = new JButton("Continue");
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				CardLayout cd = (CardLayout) myCD.getLayout();
				myControl.setNextEvent(new Event());
				
				myCD.add(new TakingMoveFrame(myControl, myCD, "Event"), "takeMove");
				cd.last(myCD);
				
			}
		});
		GroupLayout groupLayout = new GroupLayout(this);
		groupLayout.setHorizontalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addContainerGap(114, Short.MAX_VALUE)
					.addComponent(eventPicture)
					.addGap(120))
				.addGroup(groupLayout.createSequentialGroup()
					.addGap(50)
					.addComponent(lblBigJlabelDescribing, GroupLayout.PREFERRED_SIZE, 352, GroupLayout.PREFERRED_SIZE)
					.addContainerGap(32, Short.MAX_VALUE))
				.addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup()
					.addContainerGap(326, Short.MAX_VALUE)
					.addComponent(btnNewButton)
					.addGap(19))
		);
		groupLayout.setVerticalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addGap(138)
					.addComponent(eventPicture)
					.addGap(28)
					.addComponent(lblBigJlabelDescribing, GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(btnNewButton)
					.addContainerGap())
		);
		setLayout(groupLayout);
	}
}
